import { http } from "@/utils/request";
import type {
  createResType,
  createTaskTypeParamsType,
  listQueryType,
  taskPageResult,
  taskResultVo,
} from "@/interface/pm/globalTaskType.ts";

export const getTaskTypeList = (
  data: listQueryType,
): Promise<taskPageResult> => {
  return http.post("/taskType/list", data);
};

export const createTaskType = (
  data: createTaskTypeParamsType,
): Promise<createResType> => {
  return http.post("/taskType/create", data);
};

export const updateTaskType = (
  data: createTaskTypeParamsType,
): Promise<null> => {
  return http.put("/taskType/edit", data);
};

export const deleteTaskType = (id: string): Promise<null> => {
  return http.delete(`/taskType/${id}`);
};

export const deleteTaskTypeBatch = (ids: string[]): Promise<null> => {
  return http.post(`/taskType/deleteBatch`, ids);
};

export const taskTypeDetail = (id: string): Promise<taskResultVo> => {
  return http.get(`/taskType/${id}`);
};
